/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.giant.entities;

import com.giant.entities.pos.PInvoiceTax;
import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author david
 */
@Entity
@Table(name = "type_tax")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "TypeTax.findAll", query = "SELECT t FROM TypeTax t"),
    @NamedQuery(name = "TypeTax.findByIdTypeTax", query = "SELECT t FROM TypeTax t WHERE t.idTypeTax = :idTypeTax"),
    @NamedQuery(name = "TypeTax.findByDescription", query = "SELECT t FROM TypeTax t WHERE t.description = :description"),
    @NamedQuery(name = "TypeTax.findByTaxPer", query = "SELECT t FROM TypeTax t WHERE t.taxPer = :taxPer"),
    @NamedQuery(name = "TypeTax.findByStatus", query = "SELECT t FROM TypeTax t WHERE t.status = :status")})
public class TypeTax implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_type_tax")
    private Integer idTypeTax;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 100)
    @Column(name = "description")
    private String description;
    @Basic(optional = false)
    @NotNull
    @Column(name = "tax_per")
    private float taxPer;
    @Basic(optional = false)
    @NotNull
    @Column(name = "status")
    private boolean status;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idTypeTax")
    private Collection<PInvoiceTax> pInvoiceTaxCollection;

    public TypeTax() {
    }

    public TypeTax(Integer idTypeTax) {
        this.idTypeTax = idTypeTax;
    }

    public TypeTax(Integer idTypeTax, String description, float taxPer, boolean status) {
        this.idTypeTax = idTypeTax;
        this.description = description;
        this.taxPer = taxPer;
        this.status = status;
    }

    public Integer getIdTypeTax() {
        return idTypeTax;
    }

    public void setIdTypeTax(Integer idTypeTax) {
        this.idTypeTax = idTypeTax;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public float getTaxPer() {
        return taxPer;
    }

    public void setTaxPer(float taxPer) {
        this.taxPer = taxPer;
    }

    public boolean getStatus() {
        return status;
    }

    public void setStatus(boolean status) {
        this.status = status;
    }

    @XmlTransient
    public Collection<PInvoiceTax> getPInvoiceTaxCollection() {
        return pInvoiceTaxCollection;
    }

    public void setPInvoiceTaxCollection(Collection<PInvoiceTax> pInvoiceTaxCollection) {
        this.pInvoiceTaxCollection = pInvoiceTaxCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idTypeTax != null ? idTypeTax.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TypeTax)) {
            return false;
        }
        TypeTax other = (TypeTax) object;
        if ((this.idTypeTax == null && other.idTypeTax != null) || (this.idTypeTax != null && !this.idTypeTax.equals(other.idTypeTax))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.giant.entities.TypeTax[ idTypeTax=" + idTypeTax + " ]";
    }
    
}
